<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js事件体验案例一</title>
</head>

<style type="text/css">
	#div1{
		width: 100px;
		height: 100px;
		background: green;
	}
</style>

<script type="text/javascript">
	
	function fun1(){
		var div_ojb = document.getElementById("div1");
		div_ojb.style.backgroundColor = "red";
	}

	function fun2(){
		var div_ojb = document.getElementById("div1");
		div_ojb.style.backgroundColor = "black";
	}

</script>

<body>
	<div id="div1">
		
	</div>
	<div id="div2">
		<input type="button" value="红色" onclick="fun1()">
		<input type="button" value="黑色" onclick="fun2()">
	</div>	
</body>
</html>